package com.lsh.service;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author ：LiuShihao
 * @date ：Created in 2020/11/6 2:28 下午
 * @desc ：
 */
@FeignClient(value = "DEPT",fallback=UserServiceImpl.class)
public interface UserService {

    @GetMapping(value = "/dept/called")
     String callDept() ;

    /**
     * 使用Fegin 访问 带参 GET请求   表单形式
     * @param id
     * @return
     */
    @GetMapping(value = "/dept/called2",produces = "application/json;charset=UTF-8")
    String callDeptAndParam(@RequestParam("id") String id);

    /**
     * 以路径请求方式吓携带参数  Get  路径带参
     * @param id
     * @return
     */
    @GetMapping(value = "/dept/called/{id}")
    String callDeptAndParam2(@PathVariable("id") String id);

    @PostMapping(value ="/dept/beCalledPost")
    String callDeptPost(@RequestBody Map<String, String> map);

    /**
     * 使用User服务负载均衡调用Dept服务
     * @return
     */
    @GetMapping(value = "/dept")
    String dept();
}
